unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;

type
  TForm1 = class(TForm)
    img1: TImage;
    btn1: TButton;
    procedure btn1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;
const
  N=5;
var
  Form1: TForm1;
  arr: array [0..N*N-1] of TButton;
  i: integer;
implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
begin
  for i:=0 to N*N-1 do
  begin
    arr[i]:=TButton.Create(Form1);
    arr[i].Parent:=Form1;
    arr[i].Width:=18;
    arr[i].Height:=18;
    arr[i].Left:=18*(i mod N);
    arr[i].Top:=18*(i div N);
  end;
end;

end.
